#include "CargoShip.h"
#include <iostream>

CargoShip::CargoShip(std::string id, double maxLoad,
    std::string cargo, std::string status)
    : m_maxLoad(maxLoad), m_cargo(std::move(cargo)),
    m_status(std::move(status)) {
    m_id = std::move(id);
}

std::string CargoShip::type() const { return "CargoShip"; }

void CargoShip::report() const {
    std::cout << "[CargoShip]  ID=" << m_id
        << "  MaxLoad=" << m_maxLoad << "kg"
        << "  Status=" << m_status
        << "  Cargo=" << m_cargo << '\n';
}

void CargoShip::save(std::ostream& os) const {
    os << type() << '|' << m_id << '|' << m_maxLoad
        << '|' << m_status << '|' << m_cargo << '\n';
}

void CargoShip::launch() { m_status = "Launched"; }
void CargoShip::land() { m_status = "Landed"; }
void CargoShip::unload() { m_cargo = "Empty"; }